package com.ebt.m.proposal_v2.utils;

import java.util.List;
import java.util.Map;

/**
 * @author archer.qi
 *         Created on 2017/5/8.
 */
public class ArrayUtils {

    /**
     * 将生日字符串转换为年月日数组
     *
     * @param birthday
     * @param split
     * @return
     */
    public static int[] toBirthdayArray(String birthday, String split) {
        if (birthday == null || birthday.length() == 0) {
            return null;
        }
        String[] values = birthday.split(split);
        return new int[]{Integer.parseInt(values[0]), Integer.parseInt(values[1]), Integer.parseInt(values[2])};
    }

    /**
     * 列表判空
     *
     * @param list
     * @return
     */
    public static boolean isEmpty(List list) {
        if (list == null || list.size() == 0) {
            return true;
        }
        return false;
    }

    /**
     * 图判空
     *
     * @param map
     * @return
     */
    public static boolean isEmpty(Map map) {
        if (map == null || map.size() == 0) {
            return true;
        }
        return false;
    }

    /**
     * 字符串判空
     *
     * @param s
     * @return
     */
    public static boolean isEmpty(String s) {
        if (s == null || s.length() == 0) {
            return true;
        }
        return false;
    }
}
